﻿// code06020600.cpp : 参数传递
// initializer_list类

#include <iostream>
#include <string>
using namespace std;
//参数列表中参数类型相同，个数未知
void error_msg1(const initializer_list<string>& il)
{
	for (auto beg=il.begin();beg!=il.end();++beg)
	{
		cout << *beg << " ";
	}
	cout << endl;
}
//参数列表中参数类型不同，个数未知
void error_msg2(error_code e,initializer_list<string> il)
{
	cout << e.message() << ":";
	for (const auto& elem : il)
	{
		cout << elem << " ";
	}
	cout << endl;
}
int main()
{
	const string expected = "function is expected.";
	const string actual = "function is actual";
	error_msg1({ "functionX", expected, actual });
	error_code err;
	error_msg2(err, { "functionX", expected, actual });
	return 0;
}


